from selenium.webdriver.common.alert import Alert
from selenium.webdriver.common.by import By

from pageobjects.BasePage import BasePage
from selenium.webdriver.support import expected_conditions as EC

class BlogPage(BasePage):
    __CLICK_DELETE = (By.XPATH,'//button[text()="删除"]')
    __CLICK_UPDATE = (By.XPATH,'//button[text()="编辑"]')
    def click_update(self):
        self.do_click(self.__CLICK_UPDATE)
        from pageobjects.EditPage import EditPage
        return EditPage(self.driver)

    def click_delete(self):
        self.do_click(self.__CLICK_DELETE)
        self.alert_accept()
        from pageobjects.ListPage import ListPage
        return ListPage(self.driver)